package br.com.iswe.gwt.util.client;

import com.google.gwt.user.client.ui.Label;

public class LabelPropertyListener extends PropertyListenerImpl {

	private Label label;
	
	public LabelPropertyListener(Label label){
		this.label = label;
	}

	public void clear() {
		this.setValue("");
		this.label.setText("");
	}
	
	public void setValue(String value) {
		super.setValue(value);
		label.setText(value);
	}
	
	public String getValue() {
		String value = super.getValue();
		if(value == null){
			return label.getText();
		}
		return value;
	}
	
	public Label getLabel() {
		return label;
	}
	public void setLabel(Label label) {
		this.label = label;
	}

}
